

//
//  GetSetViewController.swift
//  Swift 3.0 基础语法
//
//  Created by YYY on 2017/7/21.
//  Copyright © 2017年 成品家（北京）网路科技有限公司. All rights reserved.
//

import UIKit

class GetSetViewController: CommonViewController {

    
    let banana = Banana()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        let teacher = Teacher()
        teacher.name = "张珊珊"
        
        let label = DemoLabel(frame: CGRect(x: 10, y: 50, width: 100, height: 20))
        view.addSubview(label)
        
        
        banana.title3 = nil
        
        banana.name = "老张"
        
        guard let _ = banana.name else {
            return
        }
        print(banana.name!)
        
        print(banana.title1)
        
        //banana.title = "boss"
        print(banana.title2)
        
        
        guard let _ = banana.title3 else {
            return
        }
        print(banana.title3!)
        // Do any additional setup after loading the view.
    }
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
        
        banana.name = "小明"
        print(banana.title1)
        
        //banana.title = "boss"
        print(banana.title2)
        
        
        guard let _ = banana.title3 else {
            return
        }
        print(banana.title3!)

    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
